<template>
  <div class="left-nav">
    <div
      class="pl-20px pr-20px h-40px flex items-center justify-center"
      v-for="item in leftValue"
      :key="item.id"
    >
      <span
        @click="changeTag(item.id)"
        class="titles"
        :class="item.id == selectTag ? 'active' : ''"
        >{{ item.label }}</span
      >
    </div>
  </div>
</template>
<script setup>
const props = defineProps({
  leftValue: Array,
  selectTag: Number
})
const emit = defineEmits(['setSelectTag'])
const changeTag = (val) => {
  emit('setSelectTag', val)
}
</script>
<style scoped>
.left-nav {
  width: 100%;
  font-size: 14px;
  cursor: pointer;
  position: relative;
}
.left-nav::after {
  background-color: #e4e9f2;
  bottom: 20px;
  content: ' ';
  height: auto;
  position: absolute;
  right: 8.5px;
  top: 18px;
  width: 1px;
}
.titles {
  width: 64px;
  height: 25px;
  line-height: 25px;
  text-align: right;
  background: #ebecf0;
  padding: 0 3px;
  border-radius: 4px;
  position: relative;
}
.active {
  background-color: #42526e;
  color: #fff;
  &::after {
    border-radius: 4px;
    content: '';
    height: 8px;
    position: absolute;
    right: -15px;
    top: 8px;
    width: 8px;
    z-index: 1;
    background: #42526e;
  }
}
.titles:hover {
  background-color: #42526e;
  color: #fff;
  &::after {
    border-radius: 4px;
    content: '';
    height: 8px;
    position: absolute;
    right: -15px;
    top: 8px;
    width: 8px;
    z-index: 1;
    background: #42526e;
  }
}
.titles::after {
  border-radius: 4px;
  content: '';
  height: 8px;
  position: absolute;
  right: -15px;
  top: 8px;
  width: 8px;
  z-index: 1;
  background: #e4e9f2;
}
</style>
